<%-- 
    Document   : obtener-tipos-documentos
    Created on : 14/09/2010, 04:24:34 PM
    Author     : Eduardo
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.*" %>
<%@page import="java.io.*" %>
<%@page import="pe.gob.pnp.digitalizar.beans.*" %>
<%@page import="pe.gob.pnp.digitalizar.despachadores.*" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%
    Properties prop = new Properties();
    FileInputStream in = new FileInputStream(application.getRealPath("/WEB-INF/classes/pe/gob/pnp/digitalizar/config.properties"));
    prop.load(in);
    in.close();
    int otros = Integer.parseInt(prop.getProperty("tipoDocumento.otros"));
    List<TipoDocumentoBean> tipos = DocumentoDespachador.obtenerTiposDocumentos(otros);
    pageContext.setAttribute("tipos", tipos);
    pageContext.setAttribute("otros", otros);
%>
{
    tipos:
    [
    <c:set var="i" value="0"/>
    <c:forEach var="tipo" items="${tipos}">
        ${i>0 ? "," : ""}
        {
            id: "${tipo.id}",
            descripcion: "${tipo.descripcion}"
        }
        <c:set var="i" value="${i+1}"/>
    </c:forEach>
    ],
    idOtros: "${otros}"
}